package cn.bdqn.sptparent.runner;


import cn.bdqn.sptparent.common.util.RedisUtil;
import cn.bdqn.sptparent.dao.CategoryMapper;
import cn.bdqn.sptparent.dao.ProductMapper;
import cn.bdqn.sptparent.service.CategoryService;
import cn.bdqn.sptparent.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class DataLoadRunner implements CommandLineRunner {
    @Autowired
    private CategoryService categoryService;
    @Autowired
    private RedisUtil redisUtil;
    @Override
    public void run(String... args) throws Exception {
        System.out.println("加载热点数据!");
        // 加载商品分类
        redisUtil.set("category:list",categoryService.list());
    }
}
